package com.gxa.jd.controller.front;


import com.gxa.entity.PageResult;
import com.gxa.entity.Result;
import com.gxa.jd.pojo.GoodsOrderStatus;
import com.gxa.jd.service.GoodsOrderStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/orderStatus")
public class GoodsOrderStatusController {

    @Autowired
    private GoodsOrderStatusService goodsOrderStatusService;

    @GetMapping("/findAll")
    public List<GoodsOrderStatus> findAll(){
        return goodsOrderStatusService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<GoodsOrderStatus> findPage(int page, int size){
        return goodsOrderStatusService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<GoodsOrderStatus> findList(@RequestBody Map<String,Object> searchMap){
        return goodsOrderStatusService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<GoodsOrderStatus> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  goodsOrderStatusService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public GoodsOrderStatus findById(String orderId){
        return goodsOrderStatusService.findById(orderId);
    }


    @PostMapping("/add")
    public Result add(@RequestBody GoodsOrderStatus goodsOrderStatus){
        goodsOrderStatusService.add(goodsOrderStatus);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody GoodsOrderStatus goodsOrderStatus){
        goodsOrderStatusService.update(goodsOrderStatus);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String orderId){
        goodsOrderStatusService.delete(orderId);
        return new Result();
    }

}
